package com.situ.day1;

import org.junit.Test;

import java.util.Scanner;

public class HelloWorld {

    public static void main(String[] args) {
        int $num2$ = 23;
        //int 2num = 23;
        // 变量的命名：你想表达什么意思就起什么名字
        int age = 23;
        age = 24;
        //常量，值不能改变
        final int age1 = 21;
        //Cannot assign a value to final variable 'age1'
        //age1 = 19;
    }

    //Alt+Enter
    @Test
    public void show() {
        //soutm
        System.out.println("HelloWorld.show");

    }

    @Test
    public void test1() {
        char ch = 'a';//97
        System.out.println(ch);//a
        System.out.println(ch + 1);//98
        System.out.println(ch + 2);//99
        System.out.println((char) (ch + 1));//b
        System.out.println((char) (ch + 2));//c

        double d = 3.14;
        int num = (int)d;
        System.out.println(num);
    }

    @Test
    public void test2() {
        System.out.println(8 / 2);//4
        System.out.println(8 % 2);//0
        System.out.println(8 / 5);//1
        System.out.println(8 % 5);//3
    }

    @Test
    public void test3() {
        int i = 1;
        i = i + 1;
        i++;
        ++i;
        System.out.println(i);//4
        System.out.println(i++);//4
        System.out.println(i);//5
    }

    @Test
    public void test5() {
        System.out.println(3 >= 5);//false
        System.out.println(5 < 10);//true
        System.out.println(5 == 10);//false
        System.out.println(5 <= 10);//true
        int num1 = 3;
        int num2 = 5;
        System.out.println(num1 != num2);//true

    }

    @Test
    public void test11() {
        int score1 = 67;
        int score2 = 380;
        boolean result1 = (score1 >= 60) && (score2 >= 400);
        System.out.println(result1);//false
        boolean result2 = (score1 >= 60) || (score2 >= 400);
        System.out.println(result2);//true
        System.out.println(!result2);//false
    }

    /*
        >=90   <=100      优秀
        >=80    <90       良好
        >=70    <80       一般
        >=60    <70      及格
        <60              不及格
    */
    @Test
    public void test44() {
        //int score = 18;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入成绩：");
        int score = scanner.nextInt();
        //卫语句1
        if (score < 0 || score > 100) {
            System.out.println("输入成绩非法");
            return;
        }
        //卫操作2

        if (score >= 90 && score <= 100) {
            System.out.println("优秀");
        } else if (score >= 80 && score < 90) {
            System.out.println("良好");
        } else if (score >= 70 && score < 80) {
            System.out.println("一般");
        } else if (score >= 60 && score < 70) {
            System.out.println("及格");
        } else {
            System.out.println("不及格");
        }
    }

    @Test
    public void test45() {
        int num1 = 23;
        int num2 = 27;
        int max = 0;
        if (num1 >= num2) {
            max = num1;
        } else {
            max = num2;
        }
        System.out.println("max: " + max);

        int max1 = num1 >= num2 ? num1 : num2;
        System.out.println(max1);
    }

    @Test
    public void test333() {
        int age = 28;
        System.out.println("我的年龄是23岁");
        //豆豆加加
        System.out.println("我的年龄是" + age + "岁");
    }



}
